package com.atguigu.common.exception;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@Data
@NoArgsConstructor  //无参构造
public class ErrorException extends RuntimeException {

    private Integer code;
    private String msg;


    //直接传递
    public ErrorException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    //枚举传递（建议先定义枚举）
    public ErrorException(RType RType) {
        this.code = RType.getValue();
        this.msg = RType.getMsg();
    }
}
